package org.doit.android.bobple.recommendation;

import org.doit.android.bobple.R;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

@SuppressWarnings({ "unchecked", "rawtypes" })
public class RecommnedArrayAdapter extends ArrayAdapter {
	Activity context;
	
	public RecommnedArrayAdapter(Activity context) {
		super(context, R.layout.recommend_summary_row, Constants.bobNames);
		this.context = context;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = context.getLayoutInflater();
		View row = inflater.inflate(R.layout.recommend_summary_row, null);
		TextView textView = (TextView) row.findViewById(R.id.label);
		textView.setText(Constants.bobNames[position]);
		
		ImageView imageView = (ImageView) row.findViewById(R.id.icon);
		imageView.setImageResource(Constants.bobImages[position]);
		
		TextView storeView = (TextView) row.findViewById(R.id.recommend_bobple_store);
		storeView.setText(Constants.bobStore[position]);
		
		TextView addressView = (TextView) row.findViewById(R.id.recommend_bobple_address);
		addressView.setText(Constants.bobArress[position]);
		
		TextView categoryView = (TextView) row.findViewById(R.id.recommend_bobple_category);
		categoryView.setText(Constants.bobCategory[position]);
		
		return row;
	}
}
